home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / DOCZ16.ZIP;1 / DOCZ.LIF / MACRO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-24  |  1.8 KB  |  63 lines

  1. #ifdef VCSTR
  2.  static char MACROH[]="@(#) macro.h 1.0 91/01/13 16:11:17";  /*sccsid*/
  3. #endif
  4. #ifdef DOCUMENTATION
  5.  ******************************* DOCZ Header *********************************
  6. .MODULE                onerror
  7. .LIBRARY             csub
  8. .TYPE                 macro
  9. .APPLICATION        system
  10. .APPLICATION        error
  11. .SYSTEM                vms
  12. .AUTHOR                Software Toolz
  13. .LANGUAGE            C
  14. .DESCRIPTION        
  15.     Establish an exception handler
  16. .ARGUMENTS            
  17.     onerror(func)
  18.         int (*func)();         /* (r) the address of the exception handler */
  19. .NARRATIVE            
  20.     Onerror establishes an exception handler for the currently executing
  21.     function.  The exception handler will be passed two arguments describing
  22.     the exeption as:
  23.     
  24.     int ex_handle(signal,mechanism)
  25.         int    signal[],
  26.                 mechanism[];
  27. .RETURNS     
  28.     A pointer to the previous exception vector, or 0 if there was none.
  29. .EXAMPLE
  30.     /**************************************************************************
  31.         A sample exception handler
  32.     **************************************************************************/
  33.     errfunc(signal,mechanism)
  34.         int    signal[],
  35.                 mechanism[];
  36.     {
  37.         if (signal[1] != SS$_SSFAIL)
  38.             return (SS$_RESIGNAL);
  39.         LIB$SIGNAL((signal[2] & 0xFFFFFFF8) | 2);     /* change FATAL to ERROR */
  40.         puts("Bad Call!\7");
  41.         return (SS$_CONTINUE);
  42.     }    /* end errfunc */
  43.  
  44.  
  45.     /**************************************************************************
  46.         Main entry
  47.     **************************************************************************/
  48.     main()
  49.     {
  50.         onerror(errfunc);
  51.         SYS$SETSFM(1);                         /* set system service failure mode */
  52.         SYS$QIOW(0,0,0,0,0,0,0,0,0,0,0,0);        /* bad call */
  53.         puts("> End <");
  54.     }
  55. .INCLUDES
  56.     csub.h
  57.     csubmac.h
  58. .ENDOC                END DOCUMENTATION
  59.  *****************************************************************************
  60. #endif
  61. #define onerror(func) LIB$ESTABLISH(func)
  62.  
  63.